<template>
  <div>
    父组件
    <!--在子传父中， $event是子传父的数据 -->
    <son-comp :money="money" @costMoney="costMoneyFn($event)" />
  </div>
</template>

<script>
import SonComp from './son-comp.vue'
export default {
  components: { SonComp },
  data() {
    return {
      money: 100
    }
  },
  methods: {
    costMoneyFn(value) {
      if (value > 80) {
        this.money = value
      } else {
        alert('别花钱了')
      }
    }

  }

}
</script>

<style>

</style>
